package com.sxbbc.common.basics.utils.idcard;

import java.util.ArrayList;
import java.util.List;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;


/**
 * 
 * 台湾地区身份证（国民身份证）的地区编码
 * @author Wahyee
 */
public enum ZoneNumTaiwanEnums {
	TAI_BEI_SHI(10, "台北市","A"),
	TAI_ZHONG_SHI(11, "台中市","B"),
	JI_LONG_SHI(12, "基隆市","C"),
	TAI_NAN_SHI(13, "台南市","D"),
	GAO_XIONG_SHI(14, "高雄市","E"),
	TAI_BEI_XIAN(15, "台北县","F"),
	YI_LAN_XIAN(16, "台南县","G"),
	TAO_YUAN_XIAN(17, "桃源县","H"),
	JIA_YI_SHI(34, "嘉义市","I"),
	XIN_ZHU_XIAN(18, "新竹县","J"),
	MIAO_LI_XIAN(19, "苗栗县","K"),
	TAI_ZHONG_XIAN(20, "台中县","L"),
	NAN_TOU_XIAN(21, "南投县","M"),
	ZHANG_HUA_XIAN(22, "彰化县","N"),
	XIN_ZHU_SHI(35, "新竹市","O"),
	YUN_LIN_XIAN(23, "云林县","P"),
	JIA_YI_XIAN(24, "嘉义县","Q"),
	TAI_NAN_XIAN(25, "台南县","R"),
	GAO_XIONG_XIAN(26, "高雄县","S"),
	PING_DONG_XIAN(27, "屏东县","T"),
	HUA_LIAN_XIAN(28, "花莲县","U"),
	TAI_DONG_XIAN(29, "台东县","V"),
	JIN_MEN_XIAN(32, "金门县","W"),
	PENG_HU_XIAN(30, "澎湖县","X"),
	YANG_MING_SHAN_GUAN_LI_JU(31, "阳明山管理局","Y"),
	LIAN_JIANG_XIAN(33, "连江县","Z");

	/** 县市/地区验证码（数字） */
	private Integer id;
	
	/** 县市/地区名称 */
	private String name;
	
	/** 县市/地区英文编号 */
	private String code;

	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private ZoneNumTaiwanEnums(Integer id, String name) {
		this.id = id;
		this.name = name;
	}
	
	private ZoneNumTaiwanEnums(Integer id, String name, String code) {
		this.id = id;
		this.name = name;
		this.code = code;
	}

	public static List<ZoneNumTaiwanEnums> queryList() {
        List<ZoneNumTaiwanEnums> list = new ArrayList<ZoneNumTaiwanEnums>();
        for (ZoneNumTaiwanEnums o : ZoneNumTaiwanEnums.values()) {
            list.add(o);
        }
        return list;
    }

    public static String getName(Integer id) {
        String str = "";
        for (ZoneNumTaiwanEnums o : ZoneNumTaiwanEnums.values()) {
            if (CalcuUtils.getInstance().isEquals(id, o.getId())) {
                str = o.getName();
                break;
            }
        }
        return str;
    }
    
    /** 
     * 根据编码获取验证码
     * @param code
     * @return
     * @author Wahyee
     */
    public static Integer getId(String code) {
    	Integer id = null;
        for (ZoneNumTaiwanEnums o : ZoneNumTaiwanEnums.values()) {
            if (o.getCode().equals(code)) {
                return o.getId();
            }
        }
        return id;
    }
}
